import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type gridProvinceResult = {
  code: number;
  message: string;
  data: {
    list: {
      provinceId: number;
      provinceName: string;
      provinceAbbr: string;
      so2Count: number;
      coCount: number;
      pmCount: number;
      aqiCount: number;
      aqiLevel: number;
    };
  };
};

/**根据省份ID获取省份信息 */
export const getGridProvinceById = (provinceId: number) => {
  return http.request<gridProvinceResult>(
    "get",
    baseUrlApi("/result/gridProvince/getGridProvinceById"),
    {
      params: { provinceId: provinceId }
    }
  );
};

/**获取数据库中的所有省份信息 */
export const listProvinces = () => {
  return http.request<gridProvinceResult>(
    "post",
    baseUrlApi("/result/gridProvince/getAllGridProvinces")
  );
};
